{extend  name="index/index" /}
<!-- 内容区域 -->
<div class="tpl-content-wrapper">
    {block name="main"}
    <div style="display: none" class="row-content am-cf">
        <div class="row  am-cf">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-4">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title am-fl">月度财务收支计划</div>
                        <div class="widget-function am-fr">
                            <a href="javascript:;" class="am-icon-cog"></a>
                        </div>
                    </div>
                    <div class="widget-body am-fr">
                        <div class="am-fl">
                            <div class="widget-fluctuation-period-text">
                                ￥61746.45
                                <button class="widget-fluctuation-tpl-btn">
                                    <i class="am-icon-calendar"></i>
                                    更多月份
                                </button>
                            </div>
                        </div>
                        <div class="am-fr am-cf">
                            <div class="widget-fluctuation-description-amount text-success" am-cf>
                                +￥30420.56

                            </div>
                            <div class="widget-fluctuation-description-text am-text-right">
                                8月份收入
                            </div>
                        </div>
                    </div>
                </div>

            </div>
            <div class="am-u-sm-12 am-u-md-6 am-u-lg-4">
                <div class="widget widget-primary am-cf">
                    <div class="widget-statistic-header">
                        本季度利润
                    </div>
                    <div class="widget-statistic-body">
                        <div class="widget-statistic-value">
                            ￥27,294
                        </div>
                        <div class="widget-statistic-description">
                            本季度比去年多收入 <strong>2593元</strong> 人民币
                        </div>
                        <span class="widget-statistic-icon am-icon-credit-card-alt"></span>
                    </div>
                </div>
            </div>
            <div class="am-u-sm-12 am-u-md-6 am-u-lg-4">
                <div class="widget widget-purple am-cf">
                    <div class="widget-statistic-header">
                        本季度利润
                    </div>
                    <div class="widget-statistic-body">
                        <div class="widget-statistic-value">
                            ￥27,294
                        </div>
                        <div class="widget-statistic-description">
                            本季度比去年多收入 <strong>2593元</strong> 人民币
                        </div>
                        <span class="widget-statistic-icon am-icon-support"></span>
                    </div>
                </div>
            </div>
        </div>

        <div class="row am-cf">
            <div class="am-u-sm-12 am-u-md-8">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title am-fl">月度财务收支计划</div>
                        <div class="widget-function am-fr">
                            <a href="javascript:;" class="am-icon-cog"></a>
                        </div>
                    </div>
                    <div class="widget-body-md widget-body tpl-amendment-echarts am-fr" id="tpl-echarts">
                    </div>
                </div>
            </div>
        </div>
        <div class="row am-cf">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-4 widget-margin-bottom-lg ">
                <div class="tpl-user-card am-text-center widget-body-lg">
                    <div class="tpl-user-card-title">
                        禁言小张
                    </div>
                    <div class="achievement-subheading">
                        月度最佳员工
                    </div>
                    <img class="achievement-image" src="/static/admin/main/assets/img/user07.png" alt="">
                    <div class="achievement-description">
                        禁言小张在
                        <strong>30天内</strong> 禁言了
                        <strong>200多</strong>人。
                    </div>
                </div>
            </div>

            <div class="am-u-sm-12 am-u-md-12 am-u-lg-8 widget-margin-bottom-lg">

                <div class="widget am-cf widget-body-lg">

                    <div class="widget-body  am-fr">
                        <div class="am-scrollable-horizontal ">
                            <table width="100%" class="am-table am-table-compact am-text-nowrap tpl-table-black "
                                   id="example-r">
                                <thead>
                                <tr>
                                    <th>文章标题</th>
                                    <th>作者</th>
                                    <th>时间</th>
                                    <th>操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <tr class="gradeX">
                                    <td>新加坡大数据初创公司 Latize 获 150 万美元风险融资</td>
                                    <td>张鹏飞</td>
                                    <td>2016-09-26</td>
                                    <td>
                                        <div class="tpl-table-black-operation">
                                            <a href="javascript:;">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                            <a href="javascript:;" class="tpl-table-black-operation-del">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="even gradeC">
                                    <td>自拍的“政治角色”：观众背对希拉里自拍合影表示“支持”</td>
                                    <td>天纵之人</td>
                                    <td>2016-09-26</td>
                                    <td>
                                        <div class="tpl-table-black-operation">
                                            <a href="javascript:;">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                            <a href="javascript:;" class="tpl-table-black-operation-del">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="gradeX">
                                    <td>关于创新管理，我想和你当面聊聊。</td>
                                    <td>王宽师</td>
                                    <td>2016-09-26</td>
                                    <td>
                                        <div class="tpl-table-black-operation">
                                            <a href="javascript:;">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                            <a href="javascript:;" class="tpl-table-black-operation-del">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="even gradeC">
                                    <td>究竟是趋势带动投资，还是投资引领趋势？</td>
                                    <td>着迷</td>
                                    <td>2016-09-26</td>
                                    <td>
                                        <div class="tpl-table-black-operation">
                                            <a href="javascript:;">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                            <a href="javascript:;" class="tpl-table-black-operation-del">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                <tr class="even gradeC">
                                    <td>Docker领域再添一员，网易云发布“蜂巢”，加入云计算之争</td>
                                    <td>醉里挑灯看键</td>
                                    <td>2016-09-26</td>
                                    <td>
                                        <div class="tpl-table-black-operation">
                                            <a href="javascript:;">
                                                <i class="am-icon-pencil"></i> 编辑
                                            </a>
                                            <a href="javascript:;" class="tpl-table-black-operation-del">
                                                <i class="am-icon-trash"></i> 删除
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>

            </div>
        </div>
    </div>
    <div class="container-fluid am-cf">
        <div class="row">
            <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
                <div class="widget am-cf">
                    <div class="widget-head am-cf">
                        <div class="widget-title  am-cf">用户列表</div>
                    </div>
                    <div class="widget-body  am-fr">
                        <form class="am-form tpl-form-border-form tpl-form-border-br" >
                            <div class="am-u-sm-12 am-u-md-6 am-u-lg-3">
                                <!--<div class="am-form-group tpl-table-list-select ">-->
                                    <!--<select class="mycate" data-am-selected="{btnSize: 'sm'}">-->
                                        <!--<option value="-1">全部</option>-->
                                        <!--<option value="1">已报名</option>-->
                                        <!--<option value="0">未报名</option>-->
                                    <!--</select>-->
                                <!--</div>-->
                            </div>

                        </form>
                        <div class="am-u-sm-12">
                            <table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
                                <thead>
                                <tr>
                                    <th class="am-text-middle">头像</th>
                                    <th class="am-text-middle">用户名</th>
                                    <th class="am-text-middle">姓名</th>
                                    <th class="am-text-middle">电话</th>
                                    <!--<th class="am-text-middle">状态</th>-->
                                    <th class="am-text-middle">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name="data" id="user"}
                                <tr class="gradeX">
                                    <td>
                                        {switch name="$user.uimg"}
                                        {case value=""}
                                        <img src="/static/admin/main/assets/img/k.jpg" class="tpl-table-line-img"
                                             alt="">
                                        {/case}
                                        {default /}
                                        <img src="/uploads/{$user.uimg}" class="tpl-table-line-img" alt="用户头像">
                                        {/switch}
                                    </td>
                                    <td class="am-text-middle">{$user.username}</td>
                                    <td class="am-text-middle">{$user.uname}</td>
                                    <td class="am-text-middle">{$user.utel}</td>
                                    <td class="am-text-middle">
                                        <div class="tpl-table-black-operation">
                                            <a href="{:url('admin/User/edit',['uid'=>$user.uid])}" class="myedit">
                                                <i class="am-icon-pencil" data-id="{$user.uid}"></i> 编辑
                                            </a>
                                            <a href="{:url('admin/User/course',['uid'=>$user.uid])}" class="myedit">
                                                <i class="am-icon-pencil" data-id="{$user.uid}"></i> 查看课程
                                            </a>
                                            <!--<a href="{:url('admin/User/course',['uid'=>$user.uid])}" class="myedit">-->
                                                <!--<i class="am-icon-pencil" data-id="{$user.uid}"></i> 查看学员-->
                                            <!--</a>-->
                                            <a href="javascript:;" class="tpl-table-black-operation-del myblack" data-id="{$user.uid}">
                                            <i class="am-icon-close"></i>
                                            <span class="myspan">{if condition="$user.black==1"}移出黑名单
                                            {else /}移入黑名单{/if}</span>
                                            </a>
                                        </div>
                                    </td>
                                </tr>
                                {/volist}
                                </tbody>
                            </table>
                        </div>
                        <div class="am-u-lg-12 am-cf">
                            {$page}
                        </div>
                    </div>
                </div>
            </div>
        </div>

    </div>
    {/block}

</div>
{block name="myjs"}
<script>
    $(function () {
        $('.myedit').click(function () {
            var myedit = $(this);
            var uid = myedit.find('i').attr('data-id');
            console.log(uid);
            $.ajax({
                type: 'get',
                dataType: 'html',
                data: {
                    'uid': uid
                },
                url: "{:url('admin/User/edit')}",
                success: function (data) {
                    $('.mycontent').html(data);
                }
            });
        });
        $('.myblack').click(function () {
            var myblack = $(this);
            var uid = $(this).attr('data-id');
            var html = myblack.find('.myspan').html();
            html = $.trim(html);
            console.log(html);
            if (html =='移入黑名单') {
                console.log(1);
                $.ajax({
                    type: 'get',
                    dataType: 'html',
                    data: {
                        'uid': uid
                    },
                    url: "{:url('admin/User/joinBlack')}",
                    success: function (data) {
                        if (data) {
                            myblack.find('.myspan').html('移出黑名单');
                        }
                    }
                });
            }else if(html == '移出黑名单'){
                $.ajax({
                    type: 'get',
                    dataType: 'html',
                    data: {
                        'uid': uid
                    },
                    url: "{:url('admin/User/outBlack')}",
                    success: function (data) {
                        if (data) {
                            myblack.find('.myspan').html('移入黑名单');
                        }
                    }
                });
            }
        });
        $('.mycate').change(function(){
            var status = $(this).val();
            $.ajax({
                type: 'get',
                dataType: 'html',
                data: {
                    'status': status
                },
                url: "{:url('admin/User/cate')}",
                success: function (data) {
                    if (data) {
                        $('tbody').replaceWith(data);
                    }
                }
            });

        });
    });
</script>
{/block}
